package com.sskj.lib.util;

import android.app.Activity;
import android.text.TextUtils;

import com.alibaba.android.arouter.launcher.ARouter;
import com.sskj.common.base.App;
import com.sskj.common.util.ToastUtil;
import com.sskj.lib.Constans;
import com.sskj.lib.R;
import com.sskj.lib.RConfig;
import com.sskj.lib.bean.UserData;

public class AppInnerCheckUtil {

    /**
     * 验证手机号
     *
     * @param userData
     * @return
     */
    public static boolean checkTel(Activity activity, UserData userData) {
        if (userData==null)
            return false;
        if (TextUtils.isEmpty(userData.getMobile())) {
            ToastUtil.showShort( App.INSTANCE.getString(R.string.lib_appInnerCheckUtil1));
            return false;
        }
        return true;
    }

    /**
     * 验证实名认证
     *
     * @param userData
     * @return 1 未认证 2 待审核 3 已通过  4拒绝
     */
    public static boolean checkAuth(Activity activity, UserData userData) {
        if (userData==null)
            return false;
        if (userData.getStatus() == 1) {
            ToastUtil.showShort( App.INSTANCE.getString(R.string.lib_appInnerCheckUtil2));
            return false;
        }
        if (userData.getStatus() == 2) {
            ToastUtil.showShort( App.INSTANCE.getString(R.string.lib_appInnerCheckUtil3));
            return false;
        }
        if (userData.getStatus() == 4) {
            ToastUtil.showShort( App.INSTANCE.getString(R.string.lib_appInnerCheckUtil4));
            return false;
        }
        return true;
    }


    /**
     * 验证交易密码
     *
     * @param userData
     * @return 是否设置交易密码 1 是 0否
     */
    public static boolean checkTradePwd(Activity activity, UserData userData,String content) {
        if (userData==null)
            return false;
        if (userData.getIs_pwd() != 1) {
            ToastUtil.showShort(String.format(App.INSTANCE.getString(R.string.lib_appInnerCheckUtil1_h),content));
            return false;
        }
        return true;
    }

    /**
     * 验证支付方式
     *
     * @param userData
     * @return
     */
    public static boolean checkPayType(Activity activity, UserData userData) {
        if (TextUtils.isEmpty(userData.getPayment_type())) {
            ToastUtil.showShort( App.INSTANCE.getString(R.string.lib_appInnerCheckUtil5));
            return false;
        }
        return true;
    }


    /**
     * 验证商家
     *
     * @param userData
     * @return
     */
    public static boolean checkShop(Activity activity, UserData userData) {
        return true;
    }
}
